首页>代码>springMVC+Mybatis+Spring+Easyui+zTree+ueditor+highchart企业IT信息管理系统>/IT_M - 副本/src/com/gree/ssm/controller/AmassController.java
package com.gree.ssm.controller; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.joda.time.DateTime; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.github.pagehelper.PageInfo; import com.gree.ssm.po.SoftAmass; import com.gree.ssm.po.SoftAmassCustom; import com.gree.ssm.po.SoftInfo; import com.gree.ssm.po.UserInfo; import com.gree.ssm.service.SoftAmassService; import com.gree.ssm.service.SoftInfoService; @Controller @RequestMapping("/amass") public class AmassController { @Autowired private SoftAmassService softAmassService; @Autowired private SoftInfoService softInfoService; /** * 打开添加文档 * * @param model * @param request * @param response * @return * @throws Exception */ @RequestMapping("/opAmassAdd") public String opAmassAdd(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception { // 页面转发 return "AmassAdd"; } @RequestMapping("/opAmassQuery") public String opAmassQuery(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception { // 页面转发 return "AmassQuery"; } @RequestMapping("/opAmassUpdate") public String opAmassUpdate(Model model, HttpServletRequest request, HttpServletResponse response,Integer amaId) throws Exception { SoftAmassCustom custom = softAmassService.findById(amaId); // List<Db> dbService.loadBySoft(softInfoCustom.getSofId()); if (custom == null) { return "error"; } model.addAttribute("custom", custom); // 页面转发 return "AmassUpdate"; } @RequestMapping("/opMyAmassUpdate") public String opMyAmassUpdate(Model model, HttpServletRequest request, HttpServletResponse response,Integer amaId) throws Exception { SoftAmassCustom custom = softAmassService.findById(amaId); // List<Db> dbService.loadBySoft(softInfoCustom.getSofId()); if (custom == null) { return "error"; } model.addAttribute("custom", custom); // 页面转发 return "AmassUpdate_User"; } @RequestMapping("/opAmassManager") public String AmassManager(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception { // 页面转发 return "AmassManager"; } @RequestMapping("/opMyAmassManager") public String opMyAmassManager(Model model, HttpServletRequest request, HttpServletResponse response) throws Exception { // 页面转发 return "AmassManager_User"; } @RequestMapping("/add") public @ResponseBody Map<String, Object> add(HttpServletRequest request, HttpServletResponse response, SoftAmass amass, String editorValue) throws Exception { Map<String, Object> re = new HashMap<String, Object>(); if(amass.getSofId()==null){ re.put("success", false); re.put("msg", "当前系统未添加系统!请联系对应系统负责人录入系统信息!"); return re; }else { SoftInfo softInfo= softInfoService.findById(amass.getSofId()); if(softInfo==null){ re.put("success", false); re.put("msg", "当前系统未添加系统!请联系对应系统负责人录入系统信息!"); return re; } } amass.setAmaNr(editorValue); UserInfo userinfo = (UserInfo) request.getSession().getAttribute( "userinfo"); amass.setUserCode(userinfo.getUserCode()); amass.setAmaTjsj(DateTime.now().toString("yyyy-MM-dd HH:mm:ss")); boolean result = softAmassService.add(amass); if (result) { re.put("success", true); re.put("msg", "添加成功"); } else { re.put("success", false); re.put("msg", "添加失败"); } return re; } @RequestMapping("/update") public @ResponseBody Map<String, Object> update(HttpServletRequest request, HttpServletResponse response, SoftAmass amass, String editorValue) throws Exception { Map<String, Object> re = new HashMap<String, Object>(); amass.setAmaNr(editorValue); boolean result = softAmassService.update(amass); if (result) { re.put("success", true); re.put("msg", "操作成功"); } else { re.put("success", false); re.put("msg", "操作失败"); } return re; } @RequestMapping("/query") public @ResponseBody Map<String, Object> query(HttpServletRequest request, HttpServletResponse response, SoftAmassCustom softAmassCustom, Integer page, Integer rows) throws Exception { Map<String, Object> re = new HashMap<String, Object>(); PageInfo<SoftAmassCustom> pageInfo = softAmassService.findPage( softAmassCustom, page, rows); if (pageInfo.getTotal() > 0) { re.put("total", pageInfo.getTotal()); re.put("rows", pageInfo.getList()); } else { re.put("total", pageInfo.getTotal()); re.put("rows", new ArrayList<SoftAmassCustom>()); } return re; } @RequestMapping("/queryByUser") public @ResponseBody Map<String, Object> queryByUser(HttpServletRequest request, HttpServletResponse response, SoftAmassCustom softAmassCustom, Integer page, Integer rows) throws Exception { Map<String, Object> re = new HashMap<String, Object>(); HttpSession session = request.getSession(); UserInfo userInfo = (UserInfo) session.getAttribute("userinfo"); PageInfo<SoftAmassCustom> pageInfo = softAmassService.findPageByUser( softAmassCustom,userInfo, page, rows); if (pageInfo.getTotal() > 0) { re.put("total", pageInfo.getTotal()); re.put("rows", pageInfo.getList()); } else { re.put("total", pageInfo.getTotal()); re.put("rows", new ArrayList<SoftAmassCustom>()); } return re; } @RequestMapping("/delete") public @ResponseBody Map<Object, Object> delete(Integer[] ids) { Map<Object, Object> resMap = new HashMap<Object, Object>(); boolean result = softAmassService.deleteByIds(ids); if (result) { resMap.put("success", true); resMap.put("msg", "删除成功!"); } else { resMap.put("success", false); resMap.put("msg", "删除失败!"); } return resMap; } @RequestMapping("/showAmassDetail") public String showAmassDetail(Model model, HttpServletRequest request, HttpServletResponse response, Integer amaId) throws Exception { SoftAmassCustom custom = softAmassService.findById(amaId); // List<Db> dbService.loadBySoft(softInfoCustom.getSofId()); if (custom == null) { return "error"; } model.addAttribute("custom", custom); return "ShowAmassDetail"; } }
最近下载更多
zhaoyangwfd LV17
2022年1月20日
wanglinddad LV55
2022年1月19日
543666826 LV33
2021年11月18日
2231788897 LV6
2021年10月20日
lewis365 LV2
2021年8月22日
ericxu1116 LV24
2021年6月7日
幸运疯子 LV13
2021年5月16日
小屁孩 LV7
2021年4月11日
skipple3 LV39
2020年11月26日
ddqddqddq LV14
2020年9月5日
最近浏览更多
李俊雄 LV3
5月8日
educationAAA LV6
5月2日
wahaha9zz
4月25日
暂无贡献等级
xiaozhi丶 LV14
4月10日
爱丽淇 LV5
3月13日
pangzhihui LV13
3月1日
qq1633 LV6
2月19日
heshao LV2
2月7日
Gin19960217 LV4
1月12日
zhangjilu LV18
1月7日